@import "../../styles/colors.less";

button{
    -webkit-appearance: button;
}
.cm-button-group{
    display: inline-block;
    &.cm-button-group-circle{
      .cm-button{
          &:first-child{
            border-top-left-radius: 50%!important;
            border-bottom-left-radius: 50%!important;
          }
          &:last-child{
            border-top-right-radius: 50%!important;
            border-bottom-right-radius: 50%!important;
          }
      }
    }
  .cm-button{
    border-radius: 0;
    border-right: 0;
    &.cm-button-icon-only{
        width: 32px;
        padding: 0;
        border-radius: 0;
        &.cm-button-large,
        &.cm-button-small{
          border-radius: 0;
        }
    }
    &:first-child{
      border-top-left-radius: 3px;
      border-bottom-left-radius: 3px;
    }
    &:last-child{
      border-top-right-radius: 3px;
      border-bottom-right-radius: 3px;
      // border-right: 1px solid #53b6ff!important;
      border-right-style: solid;
      border-right-width: 1px;
      border-right-color: @color-border;
    }
    &:last-child.primary{
      border-right-color: @color-blue!important;
    }
    &.cm-button-active{
      &.default{
          background: @color-blue;
          color: #fff;
      }
      &.primary{
        background: @color-blue-dark;
      }
    }
    &.success{
      border-color: lighten(@color-success, 10%)!important;
      &.cm-button-active{
        background: darken(@color-success, 10%);
      }
    }
    &.warning{
      border-color: lighten(@color-warning, 10%)!important;
      &.cm-button-active{
        background: darken(@color-warning, 10%);
      }
    }

    &.danger{
      border-color: lighten(@color-danger, 10%)!important;
      &.cm-button-active{
        background: darken(@color-danger, 10%);
      }
    }
  }
  .cm-button:last-child.dashed{
    border-right-style: dashed!important;
  }
  .cm-button:hover:before{
    content: '';
    position: absolute;
    z-index: 1;
    border: 1px solid @color-blue-light;
    left: -1px;
    top: -1px;
    right: -1px;
    bottom: -1px;
    -webkit-transition: border 0.2s linear;
    -moz-transition: border 0.2s linear;
    -ms-transition: border 0.2s linear;
    -o-transition: border 0.2s linear;
    transition: border 0.2s linear;
  }
  .cm-button.dashed:hover:before{
    border-style: dashed;
  }
  .cm-button:first-child:hover:before{
    border-radius: 3px 0 0 3px;
  }
  .cm-button:last-child:hover:before{
    border-radius: 0 3px 3px 0;
  }
}
.cm-button-group-disabled{
  .cm-button:hover:before{
    border: 1px solid transparent;
  }
  .cm-button:last-child.primary{
    border-color: @color-disabled!important;
  }
}
.cm-button {
  display: inline-block;
  position: relative;
  padding: 0 15px;
  height: 32px;
  vertical-align: middle;
  -webkit-user-select: none;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  text-align: center;
  outline: none;
  color: #000;
  border-radius: 3px;
  background-image: none;
  border: 1px solid transparent;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  line-height: normal;
  background-color: #fff;
  border-color: #dcdee2;

  -webkit-transition: background 0.2s linear,border 0.2s linear,color 0.2s linear,-webkit-box-shadow 0.2s linear;
  -moz-transition: background 0.2s linear,border 0.2s linear,color 0.2s linear,-moz-box-shadow 0.2s linear;
  -ms-transition: background 0.2s linear,border 0.2s linear,color 0.2s linear,-ms-box-shadow 0.2s linear;
  -o-transition: background 0.2s linear,border 0.2s linear,color 0.2s linear,-o-box-shadow 0.2s linear;
  transition: background 0.2s linear,border 0.2s linear,color 0.2s linear,box-shadow 0.2s linear;

  // -webkit-box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
  // -moz-box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
  // box-shadow: rgba(0, 0, 0, 0.117647) 0px 1px 6px, rgba(0, 0, 0, 0.117647) 0px 1px 4px;
  >span{
      display: inline-block;
  }
  svg {
    width: 16px;
    height: 16px;
    margin-top: -1px;
  }

  &.cm-button-circle{
    border-radius: 24px;
  }

  &.cm-button-icon-only{
    width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    border-radius: 50%;
    svg {
      width: 16px;
      height: 32px;
    }
  }

  &.cm-button-large{
    height: 40px;
    padding: 0 15px;
    font-size: 16px;
    border-radius: 4px;
    &.cm-button-icon-only{
      width: 40px;
      height: 40px;
      padding: 0;
      font-size: 18px;
      border-radius: 50%;
      svg {
        width: 20px;
        height: 40px;
      }
    }
  }
  &.cm-button-small{
    height: 24px;
    padding: 0 7px;
    font-size: 14px;
    &.cm-button-icon-only{
      width: 24px;
      height: 24px;
      padding: 0;
      font-size: 14px;
      border-radius: 50%;
      svg {
        width: 14px;
        height: 24px;
      }
    }
  }

  .cm-button-img{
    height: 16px;
    margin-top: -4px;
    vertical-align: middle;
  }
  i.fa{
    &.left {
    //   margin-right: 5px;
    }
    &.right {
    //   margin-left: 5px;
    }
  }

  &:hover{
    color: @color-blue-light;
    background-color: #fff;
    border-color: @color-blue-light;
  }
  &.primary{
    color: #fff;
    background-color: @color-blue;
    border-color: @color-blue;
    &:hover{
      background-color: lighten(@color-blue, 10%);
      border-color: lighten(@color-blue, 10%);
    }
  }
  &.second{
    color: #fff;
    background-color: @color-blue-light;
    border-color: @color-blue-light;
    &:hover{
      background-color: lighten(@color-blue-light, 10%);
    }
  }
  &.success{
    color: #fff;
    background-color: @color-success;
    border-color: @color-success;
    &:hover{
      background-color: lighten(@color-success, 10%);
      border-color: lighten(@color-success, 10%);
    }
  }
  &.warning{
    color: #fff;
    background-color: @color-warning;
    border-color: @color-warning;
    &:hover{
      background-color: lighten(@color-warning, 10%);
      border-color: lighten(@color-warning, 10%);
    }
  }
  &.danger{
    color: #fff;
    background-color: @color-danger;
    border-color: @color-danger;
    &:hover{
      background-color: lighten(@color-danger, 10%);
      border-color: lighten(@color-danger, 10%);
    }
  }
  &.dashed{
    color: @color-ctx;
    background-color: #fff;
    border-color: @color-border;
    border-style: dashed;
    &:hover{
      color: @color-blue-light;
      background-color: #fff;
      border-color: @color-blue-light;
    }
  }
  &.text{
    color: @color-ctx;
    background-color: #fff;
    border-color: transparent;
    &:hover{
      color: @color-blue-light;
      background-color: #fff;
      border-color: transparent;
    }
  }
  &.info{
    color: #fff;
    background-color: @color-info;
    border-color: @color-info;
    &:hover{
      background-color: lighten(@color-info, 10%);
    }
  }

  &[disabled]{
    color: rgba(0,0,0,0.3);
    cursor: not-allowed;
    background: transparent;
    border-color: @color-disabled;
    &:hover{
      background: transparent;
      border-color: @color-disabled;
      color: rgba(0,0,0,0.3);
    }
    i.fa{
      color: rgba(0,0,0,0.3);
    }
    &.text{
      border-color: transparent;
    }
  }
  .fa-spin {
    -webkit-animation: fa-spin 1s infinite linear;
    animation: fa-spin 1s infinite linear;
  }
}

.cm-button-loading{
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
  margin-top: -2px;
}
.cm-button.cm-button-small .cm-button-loading{
  margin-top: -4px;
}

a.cm-button{
  line-height: 32px;
  &.small{
    line-height: 24px;
  }
  &.large{
    line-height: 40px;
  }
}